Function.RegisterNamespace("System.Script.ScriptLoadStrategy");

System.Script.ScriptLoadStrategy.SpiderMonkey=function(){
    function SpiderMonkey(){
        this.base();
    }
    SpiderMonkey.apply(this,arguments);

    // ILoadStrategy Members
    this.Load=function(source){
        var lines=source.split("\n");
        var path=String.Trim(lines[lines.length-1].split("//@ sourceURL=")[1]||'');
        return evaluate(source,{fileName:path});
    };

    // IStrategSpecification Members
    this.IsSatisfiedBy=function(candidate){
        return (typeof(system)!='undefined' && typeof(version)!='undefined' && typeof(snarf)!="undefined" && typeof(evaluate)!="undefined");
    };
};

System.Script.ScriptLoadStrategy.SpiderMonkey.Inherit(System.Script.ScriptLoadStrategy.Generic,"System.Script.ScriptLoadStrategy.SpiderMonkey");
System.Script.ScriptLoader.Strategies.Add(System.Script.ScriptLoadStrategy.SpiderMonkey,0);